package com.example.mapper.many_to_many;

import com.example.bean.Course;
import org.apache.ibatis.annotations.Result;
import org.apache.ibatis.annotations.Results;
import org.apache.ibatis.annotations.Select;

import java.util.List;

/**
 * @program: mybatis_maven
 * @description:
 * @author: zhanghz001
 * @create: 2020-11-10 19:52
 **/
public interface CourseMapper {

    @Select("select c.id cid, c.NAME cname\n" +
            "from course c\n" +
            "left join stu_cr sc on c.id = sc.cid\n" +
            "where sc.sid=#{id};")
    @Results({
            @Result(property = "id", column = "cid"),
            @Result(property = "name", column = "cname")
    })
    List<Course> selectBySid(Integer id);

}
